package com.announcement.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;

import com.announcement.entity.vo.Page;

public interface BaseDao<T, PK extends Serializable> {

	public PK save(T entity);

	public void saveOrUpdate(T entity);

	public void update(T entity);

	public void merge(T entity);

	public void delete(PK id);

	public void deleteObject(T entity);

	public boolean exists(PK id);

	public T load(PK id);

	public T get(PK id);

	public int countAll();

	public int countAll(Criteria criteria);

	public void deleteAll(Collection<?> entities);

	public List<T> list();

	public List<T> list(Criteria criteria);

	@SuppressWarnings("hiding")
	public <T> List<T> list(DetachedCriteria criteria);

	public List<T> list(String orderBy, boolean isAsc);

	public List<T> list(String propertyName, Object value);

	public List<T> list(Criterion... criterions);

	public T uniqueResult(String propertyName, Object value);

	public T uniqueResult(Criterion... criterions);

	public T uniqueResult(Criteria criteria);

	public Criteria distinct(Criteria criteria);

	public void flush();

	public void clear();

	public Criteria createCriteria();

	public Criteria createCriteria(Criterion... criterions);

	public List<T> findPageByCriteria(Criteria criteria, int pageIndex,
			int pageSize);

	public Page<T> findPage(int pageSize, int pageIndex, String hql);

	public List<T> getPage(int pageSize, int pageIndex, String hql);
}
